Supporting Tools & Maintenance
These are standards and processes that help maintain and debug the application
Errors & Logs
Most GramChain errors are logged in table to help debug errors. The table is self-explanatory. Note that the table relies on trapping errors writing it to the DB. Not all errors might be captured here.
Data Structure Overview
EntityID allows for filtering by EntityID
EntityContextID is used to search for very specific granular error details – if available. If an error occurs while confirming a Blockchain TransactionID then this field will contain the TransactionID when the error occurred. Depending on the Error it could be a hash, a username or any other specific ID.
EntityCategory this is arbitrary category set in code to help grouping errors.
ErrorProcedure this is the method or class in GramChain C# where the error occurred.
ErrorDescription the available information on the error as returned by the code. This field is up to 7000 characters long.
LogTime time of the error in UTC.
CallerID the user who initiated the process that caused the issue
Read APIs
/Secured/ErrorLog is the API that allows for retrieval of Errors. Variables for filtering records are described in the API interface.
GlobalSettings
Any system variable that should not be hardcoded in code can be put in the GlobalSettings table. The variable will be made available via caching in the GlobalSettings Class – by Name, EntityID & AsOfDate - for efficient retrieving within GramChain. The GlobalSettings does not have a provision for securing passwords so highly sensitive entries should not be placed here.
Globalsettings use a log system so that values are never overwritten. Instead new entries are added using validity periods specified in the ValidFrom / ValidTo fields. This system ensures that data is always kept and past entries can be easily retrieved by specifying the AsOfDate parameter of a select function. For example, if images are to be retrieved from different servers based on their creation date then the image creation date can be passed as the AsOfDate parameter to retrieve them from the correct server.
Data Structure Overview
EntityID allows for settings specific to a given entity. An empty EntityID denotes a default setting. For example, the GlobalSettings name “ImageFilesWebPath” with EntityID “” determines where images are to be stored by default. If an entity XX requires images to be stored in a different location then a second “ImageFilesWebPath” with EntityID “XX” should be added.
Name is the ID that identifies the specific setting to retrieve. The name should reflect the function of the setting for clarity. While the variable is unique in function retrieval also requires the EntityID, in case the entity uses a non-default setting, and an AsOfDate to determine what the value was at a given time point. By default AsOfDate is UTCNow as typically the current value is required.
TextValue & DataType is the value of the setting and its data type (#C notation) respectively. Since databases don’t have generic data type the setting is always stored as a varchar/string. By specifying a datatype, e.g. int, it is clear that the variable can be safely converted into the specified datatype in code.
ValidFrom & ValidTo these fields keep track for what periods a given value is valid. The AsOfDate used in queries determines which validity period is chosen. The insert stored procedure automatically handles these fields and they can normally be ignored by application developers.
Category & SettingDesc allow for grouping and a description of use. These fields are most useful to create online documentation.
Read & Write APIs
/Secured/GlobalSettings is the API that allows for retrieval of GlobalSettings. Variables are described in the API interface.
/Secured/GlobalSettingsInsert is the API that allows for insert of GlobalSettings. Variables are described in the API interface.
Recurring Jobs
Certain processes should be running periodically. This section list the APIs and processes should be run regularly.
- Hash_UnconfirmedTrxID_Check -- Tries to confirm any unconfirmed hashes (if any)
- Hash_UnsentBroadcastHashes_Check -- rebroadcasts missing hashes or batched hashes (if any)